﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using WebApi.Core.IRepository;
using WebApi.Core.Model;

namespace WebApi.Core.Repository
{
    public class UserRepository : IUserRepository<UserEntity>
    {
        private readonly List<UserEntity> _users;

        public UserRepository()
        {
            _users = new List<UserEntity>()
            { 
                new UserEntity(){ UserId =1,UserName="韩信",Age=24},
                new UserEntity(){ UserId =2,UserName="李白",Age=23},
                new UserEntity(){ UserId =3,UserName="貂蝉",Age=22}
            };
        }

        public Task<bool> Add(UserEntity model)
        {
            throw new NotImplementedException();
        }

        public Task<bool> DeleteByIds(object[] ids)
        {
            throw new NotImplementedException();
        }

        public async Task<UserEntity> QueryByID(int id)
        {
            var model = Task.Run(() => _users.Find(x => x.UserId == id));
            return await model;
        }

        public Task<bool> Update(UserEntity model)
        {
            throw new NotImplementedException();
        }
    }
}
